<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px">
      <el-form-item label="品名" prop="projectId">
        <el-select v-model="queryParams.projectId" placeholder="请选择品名" clearable filterable size="small">
          <el-option
            v-for="dict in projectOptions"
            :key="dict.projectId"
            :label="dict.name"
            :value="dict.projectId"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="机型" prop="machineType">
        <el-select v-model="queryParams.machineType" placeholder="请选择机型" clearable filterable size="small"
                   @change="handleMachineChange"
        >
          <el-option
            v-for="dict in machineTypeOptions"
            :key="dict.dictValue"
            :label="dict.dictLabel"
            :value="dict.dictValue"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="货号" prop="itemNo">
        <el-input v-model="queryParams.itemNo" placeholder="请输入货号" clearable>
        </el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['product:reagentFormDetail:add']"
        >新增
        </el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['product:reagentFormDetail:edit']"
        >修改
        </el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['product:reagentFormDetail:remove']"
        >删除
        </el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['product:reagentFormDetail:export']"
        >导出
        </el-button>
      </el-col>
    </el-row>

    <el-table v-loading="loading" :data="reagentFormList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center"/>
      <el-table-column label="品名" align="center" prop="projectId" :formatter="projectFormat"/>
      <el-table-column label="机型" align="center" prop="machineType" :formatter="machineTypeFormat"/>
      <el-table-column label="货号" align="center" prop="itemNo"/>
      <el-table-column label="标签模板" align="center" prop="boxBarcodeTagTempCodeno"/>
      <el-table-column label="包装规格" align="center" :formatter="specFormat"/>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['product:reagentFormDetail:edit']"
          >修改
          </el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['product:reagentFormDetail:remove']"
          >删除
          </el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改试剂表单对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="1560px" append-to-body :close-on-click-modal="false">
      <el-row :gutter="15">
        <el-form ref="form" :model="form" :rules="rules" label-width="0">
          <el-row :gutter="15">
            <el-col :span="6">
              <el-form-item label="品名" prop="projectId" label-width="120px">
                <el-select v-model="form.projectId" placeholder="请选择品名"
                           filterable clearable
                           :disabled="disabledProject"
                           @change="handleProjectChange"
                >
                  <el-option
                    v-for="dict in projectOptions"
                    :key="dict.projectId"
                    :label="dict.name"
                    :value="dict.projectId"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="机型" prop="machineType" label-width="85px">
                <el-select v-model="form.machineType" placeholder="请选择机型"
                           filterable clearable
                           :disabled="disabledMachineType"
                           @change="handleMachineChange"
                >
                  <el-option
                    v-for="dict in machineTypeOptions"
                    :key="dict.dictValue"
                    :label="dict.dictLabel"
                    :value="dict.dictValue"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="货号" prop="itemNo" label-width="85px">
                <el-input v-model="form.itemNo" clearable
                          placeholder="请输入货号">
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="序列号" prop="boxSeqNo" label-width="85px">
                <el-input-number controls-position="right" :min="1" :max="99999" v-model.number="form.boxSeqNo"
                                 clearable
                                 style="width: 150px"
                                 placeholder="请输入序列号">
                </el-input-number>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="标签模板" prop="boxBarcodeTagTempCodeno" label-width="120px">
                <el-select v-model="form.boxBarcodeTagTempCodeno" placeholder="请选择模板编号"
                           filterable
                >
                  <el-option
                    v-for="item of machineBoxBarcodeTagOptions"
                    :key="item.boxBarcodeTagTempId"
                    :title="item.tempName"
                    :label="item.tempCodeno"
                    :value="item.tempCodeno"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="表单模式" prop="formMode" label-width="85px">
                <el-select v-model="form.formMode" placeholder="请选择表单模式" @change="handleFormModeChange">
                  <el-option
                    v-for="dict of formModeOptions"
                    :key="dict.dictValue"
                    :label="dict.dictLabel"
                    :value="dict.dictValue"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="盒贴单位" prop="specUnit" label-width="85px">
                <el-select v-model="form.specUnit" placeholder="请选择盒贴单位">
                  <el-option
                    v-for="dict of specUnitOptions"
                    :key="dict.dictValue"
                    :label="dict.dictLabel"
                    :value="dict.dictValue"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="分装单位" prop="productUnit" label-width="85px">
                <el-select v-model="form.productUnit" placeholder="请选择分装单位">
                  <el-option
                    v-for="dict of productUnitOptions"
                    :key="dict.dictValue"
                    :label="dict.dictLabel"
                    :value="dict.dictValue"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="规格前缀" prop="specPrefix" label-width="120px">
                <el-select v-model="form.specPrefix" placeholder="请选择规格前缀"
                           filterable clearable
                >
                  <el-option
                    v-for="dict of specPrefixOptions"
                    :key="dict.dictValue"
                    :label="dict.dictLabel"
                    :value="dict.dictValue"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item prop="boxTagPrint" label-width="85px">
                <el-checkbox v-model="form.boxTagPrint" label="生成盒贴"/>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item prop="containCalibrator" label-width="85px">
                <el-checkbox v-model="form.containCalibrator" label="含校准品"/>
              </el-form-item>
            </el-col>
          </el-row>
          <el-divider><h4>规格信息</h4></el-divider>
          <!--表单模式 默认 start-->
          <el-row :gutter="15" v-if="defaultModeShow">
            <el-row type="flex" justify="center" style="text-align: center">
              <el-col :span="2">
                <el-form-item><b>试剂组份</b></el-form-item>
              </el-col>
              <el-col :span="2">
                <el-form-item><b>包装瓶</b></el-form-item>
              </el-col>
              <el-col :span="2">
                <el-form-item><b>标签模板</b></el-form-item>
              </el-col>
              <el-col :span="1">
                <el-form-item><b>生成瓶贴</b></el-form-item>
              </el-col>
              <el-col :span="2">
                <el-form-item><b>序列号</b></el-form-item>
              </el-col>
              <el-col :span="3">
                <el-form-item><b>分装量</b></el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item><b>包装规格</b></el-form-item>
              </el-col>
            </el-row>
            <template v-for="item in form.insReagentFormDetailList">
              <el-col :span="2">
                <el-form-item label-width="80" style="margin-left: 20px;">
                  <el-tag v-model="item.reagentType" type="danger" style="
                      font-size: 14px;
                      font-weight: bold;
                  ">{{ reagentTypeFormat2(item.reagentType) }}
                  </el-tag>
                </el-form-item>
              </el-col>
              <el-col :span="2">
                <el-form-item>
                  <el-select v-model="item.bottleTypeId" placeholder="请选择包装瓶" clearable @change="handleForceUpdate">
                    <el-option
                      v-for="dict in bottleTypeOptions"
                      :key="dict.bottleTypeId"
                      :label="dict.bottleName"
                      :value="dict.bottleTypeId"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="2">
                <el-form-item>
                  <el-select v-model="item.bottleBarcodeTagTempCodeno" placeholder="请选择模板编号" clearabl
                             @change="handleForceUpdate">
                    <el-option
                      v-for="item in machineBottleBarcodeTagOptions"
                      :key="item.bottleBarcodeTagTempId"
                      :title="item.tempName"
                      :label="item.tempCodeno"
                      :value="item.tempCodeno"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="1">
                <el-form-item label-width="10px">
                  <el-checkbox v-model="item.bottleTagPrint" @change="handleForceUpdate"/>
                </el-form-item>
              </el-col>
              <el-col :span="3">
                <el-form-item>
                  <el-input-number v-model="item.seqNo"
                                   style="width: 140px;"
                                   :min="1"
                                   controls-position="right"
                                   @change="handleForceUpdate"
                                   placeholder="序列号">
                  </el-input-number>
                </el-form-item>
              </el-col>
              <el-col :span="3">
                <el-form-item>
                  <el-input-number v-model="item.productVolume"
                                   style="width: 140px;"
                                   :min="1" :precision="1"
                                   controls-position="right"
                                   @change="handleForceUpdate"
                                   placeholder="装量">
                  </el-input-number>
                  ml/瓶
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-col :span="8">
                  <el-form-item>
                    <el-input-number v-model="item.reagentVolume"
                                     style="width: 140px;"
                                     :min="1" :precision="1"
                                     @change="handleForceUpdate"
                                     placeholder="规格"
                                     controls-position="right">
                    </el-input-number>
                    ml/瓶
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item>
                    <el-input-number v-model="item.reagentSize"
                                     style="width: 140px;"
                                     :min="1"
                                     controls-position="right"
                                     @change="handleForceUpdate"
                                     placeholder="规格">
                    </el-input-number>
                    瓶/盒
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item>
                    <el-input-number v-model="item.testCount"
                                     style="width: 140px;"
                                     :min="10"
                                     :step="10"
                                     controls-position="right"
                                     @change="handleForceUpdate"
                                     placeholder="规格">
                    </el-input-number>
                    Tests
                  </el-form-item>
                </el-col>
              </el-col>
            </template>
          </el-row>
          <!--表单模式 默认 end-->
          <!--表单模式 杜邦 start-->
          <el-row :gutter="15" v-if="secondModeShow">
            <el-row type="flex" justify="center" style="text-align: center">
              <el-col :span="3">
                <el-form-item><b>试剂组份</b></el-form-item>
                <el-form-item v-for="(item2 ,index2) of form.dbReagentFormDetailList" :key="index2">
                  <el-tag v-model="item2.reagentType" type="danger" style="
                      font-size: 14px;
                      font-weight: bold;
                  ">{{ reagentTypeFormat2(item2.reagentType) }}
                  </el-tag>
                  <!--                  <el-select style="width: 140px;" v-model="item2.reagentType">-->
                  <!--                    <el-option-->
                  <!--                      v-for="dict of reagentTypeOptions"-->
                  <!--                      :key="dict.dictValue"-->
                  <!--                      :label="dict.dictLabel"-->
                  <!--                      :value="dict.dictValue"-->
                  <!--                    ></el-option>-->
                  <!--                  </el-select>-->
                </el-form-item>
              </el-col>
              <el-col :span="3">
                <el-form-item><b>包装瓶</b></el-form-item>
                <el-form-item style="margin-top: 196px;">
                  <el-select v-model="form.bottleTypeId" placeholder="请选择包装瓶" clearable
                             style="width: 140px;"
                             @change="handleForceUpdate">
                    <el-option
                      v-for="dict in bottleTypeOptions"
                      :key="dict.bottleTypeId"
                      :label="dict.bottleName"
                      :value="dict.bottleTypeId"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="3">
                <el-form-item><b>标签模板</b></el-form-item>
                <el-form-item style="margin-top: 196px;">
                  <el-select v-model="form.bottleBarcodeTagTempCodeno" placeholder="请选择模板编号" clearabl
                             style="width: 140px;"
                             @change="handleForceUpdate">
                    <el-option
                      v-for="item in machineBottleBarcodeTagOptions"
                      :key="item.bottleBarcodeTagTempId"
                      :title="item.tempName"
                      :label="item.tempCodeno"
                      :value="item.tempCodeno"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="1">
                <el-form-item><b>生成瓶贴</b></el-form-item>
                <el-form-item style="margin-top: 196px;">
                  <el-checkbox v-model="form.bottleTagPrint" @change="handleForceUpdate"/>
                </el-form-item>
              </el-col>
              <el-col :span="3">
                <el-form-item><b>序列号</b></el-form-item>
                <el-form-item style="margin-top: 196px;">
                  <el-input-number v-model="form.seqNo"
                                   style="width: 140px;"
                                   :min="1"
                                   controls-position="right"
                                   @change="handleForceUpdate"
                                   placeholder="序列号">
                  </el-input-number>
                </el-form-item>
              </el-col>
              <el-col :span="3">
                <el-form-item><b>分装量（ml)</b></el-form-item>
                <el-form-item v-for="(item2 ,index2) of form.dbReagentFormDetailList" :key="index2">
                  <el-input-number v-model="item2.productVolume"
                                   style="width: 140px;"
                                   :min="1" :precision="1"
                                   controls-position="right"
                                   @change="handleForceUpdate"
                                   placeholder="装量">
                  </el-input-number>
                </el-form-item>
              </el-col>
              <el-col :span="2">
                <el-form-item><b>瓶孔</b></el-form-item>
                <el-form-item v-for="(item2 ,index2) of form.dbReagentFormDetailList" :key="index2">
                  <el-tag v-model="item2.bottleNo"
                          cirle type="danger" style="
                      font-size: 14px;
                      font-weight: bold;
                  ">{{ item2.bottleNo }}
                  </el-tag>
                </el-form-item>
              </el-col>
              <el-col :span="3">
                <el-form-item><b>包装规格</b></el-form-item>
                <el-form-item style="margin-top: 196px;">
                  <el-input-number v-model="form.reagentSize"
                                   style="width: 140px;"
                                   :min="1"
                                   controls-position="right"
                                   @change="handleForceUpdate"
                                   placeholder="规格">
                  </el-input-number>
                  瓶/盒
                </el-form-item>
              </el-col>
            </el-row>
          </el-row>
          <!--表单模式 杜邦 end-->
          <!--表单模式 701 start-->
          <el-row :gutter="15" v-if="thirdModeShow">
            <el-row type="flex" justify="center" style="text-align: center">
              <el-col :span="3">
                <el-form-item><b>试剂组份</b></el-form-item>
                <el-form-item v-for="(item3 ,index2) of form.cobas701ReagentFormDetailList" :key="index2">
                  <el-tag v-model="item3.reagentType" type="danger" style="
                      font-size: 14px;
                      font-weight: bold;
                  ">{{ reagentTypeFormat2(item3.reagentType) }}
                  </el-tag>
                  <!--                  <el-select style="width: 140px;" v-model="item3.reagentType">-->
                  <!--                    <el-option-->
                  <!--                      v-for="dict of reagentTypeOptions"-->
                  <!--                      :key="dict.dictValue"-->
                  <!--                      :label="dict.dictLabel"-->
                  <!--                      :value="dict.dictValue"-->
                  <!--                    ></el-option>-->
                  <!--                  </el-select>-->
                </el-form-item>
              </el-col>
              <el-col :span="3">
                <el-form-item><b>包装瓶</b></el-form-item>
                <el-form-item style="margin-top: 50px;">
                  <el-select v-model="form.bottleTypeId" placeholder="请选择包装瓶" clearable
                             style="width: 140px;"
                             @change="handleForceUpdate">
                    <el-option
                      v-for="dict in bottleTypeOptions"
                      :key="dict.bottleTypeId"
                      :label="dict.bottleName"
                      :value="dict.bottleTypeId"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="3">
                <el-form-item><b>标签模板</b></el-form-item>
                <el-form-item style="margin-top: 50px;">
                  <el-select v-model="form.bottleBarcodeTagTempCodeno" placeholder="请选择模板编号" clearabl
                             style="width: 140px;"
                             @change="handleForceUpdate">
                    <el-option
                      v-for="item in machineBottleBarcodeTagOptions"
                      :key="item.bottleBarcodeTagTempId"
                      :title="item.tempName"
                      :label="item.tempCodeno"
                      :value="item.tempCodeno"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="1">
                <el-form-item><b>生成瓶贴</b></el-form-item>
                <el-form-item style="margin-top: 50px;">
                  <el-checkbox v-model="form.bottleTagPrint" @change="handleForceUpdate"/>
                </el-form-item>
              </el-col>
              <el-col :span="3">
                <el-form-item><b>序列号</b></el-form-item>
                <el-form-item style="margin-top: 50px;">
                  <el-input-number v-model="form.seqNo"
                                   style="width: 140px;"
                                   :min="1"
                                   controls-position="right"
                                   @change="handleForceUpdate"
                                   placeholder="序列号">
                  </el-input-number>
                </el-form-item>
              </el-col>
              <el-col :span="3">
                <el-form-item><b>分装量(ml)</b></el-form-item>
                <el-form-item v-for="(item3 ,index2) of form.cobas701ReagentFormDetailList" :key="index2">
                  <el-input-number v-model="item3.productVolume"
                                   style="width: 140px;"
                                   :min="1" :precision="1"
                                   controls-position="right"
                                   @change="handleForceUpdate"
                                   placeholder="装量">
                  </el-input-number>
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-form-item><b>分装量范围(g)</b></el-form-item>
                <el-form-item v-for="(item3 ,index2) of form.cobas701ReagentFormDetailList" :key="index2">
                  <el-col :span="9">
                    <el-form-item>
                      <el-input v-model="item3.productVolumeMin"
                                style="width: 80px;"
                                @change="handleForceUpdate">
                      </el-input>
                    </el-form-item>
                  </el-col>
                  <el-col :span="2">-</el-col>
                  <el-col :span="9">
                    <el-form-item>
                      <el-input v-model="item3.productVolumeMax"
                                style="width: 80px;"
                                @change="handleForceUpdate">
                      </el-input>
                    </el-form-item>
                  </el-col>
                </el-form-item>
              </el-col>
              <el-col :span="3">
                <el-form-item><b>瓶孔</b></el-form-item>
                <el-form-item v-for="(item3 ,index2) of form.cobas701ReagentFormDetailList" :key="index2">
                  <el-select v-model="item3.bottleSize" style="width: 140px;">
                    <el-option label="大" value="大"></el-option>
                    <el-option label="小" value="小"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="3  ">
                <el-form-item><b>包装规格</b></el-form-item>
                <el-form-item style="margin-top: 50px;">
                  <el-input-number v-model="form.reagentSize"
                                   style="width: 140px;"
                                   :min="1"
                                   controls-position="right"
                                   @change="handleForceUpdate"
                                   placeholder="规格">
                  </el-input-number>
                  瓶/盒
                </el-form-item>
              </el-col>
            </el-row>
          </el-row>
          <!--表单模式 701 end-->
          <!--表单模式 西门子 start-->
          <el-row :gutter="15" v-if="fourthModeShow">
            <el-row type="flex" justify="center" style="text-align: center">
              <el-col :span="3">
                <el-form-item><b>试剂组份</b></el-form-item>
                <el-form-item v-for="(item4 ,index2) of form.siemensReagentFormDetailList" :key="index2">
                  <el-tag v-model="item4.reagentType" type="danger" style="
                      font-size: 14px;
                      font-weight: bold;
                  ">{{ reagentTypeFormat2(item4.reagentType) }}
                  </el-tag>
                  <!--                  <el-select style="width: 140px;" v-model="item4.reagentType">-->
                  <!--                    <el-option-->
                  <!--                      v-for="dict of reagentTypeOptions"-->
                  <!--                      :key="dict.dictValue"-->
                  <!--                      :label="dict.dictLabel"-->
                  <!--                      :value="dict.dictValue"-->
                  <!--                    ></el-option>-->
                  <!--                  </el-select>-->
                </el-form-item>
              </el-col>
              <el-col :span="3">
                <el-form-item><b>包装瓶</b></el-form-item>
                <el-form-item style="margin-top: 50px;">
                  <el-select v-model="form.bottleTypeId" placeholder="请选择包装瓶" clearable
                             style="width: 140px;"
                             @change="handleForceUpdate">
                    <el-option
                      v-for="dict in bottleTypeOptions"
                      :key="dict.bottleTypeId"
                      :label="dict.bottleName"
                      :value="dict.bottleTypeId"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="3">
                <el-form-item><b>标签模板</b></el-form-item>
                <el-form-item style="margin-top: 50px;">
                  <el-select v-model="form.bottleBarcodeTagTempCodeno" placeholder="请选择模板编号" clearabl
                             style="width: 140px;"
                             @change="handleForceUpdate">
                    <el-option
                      v-for="item in machineBottleBarcodeTagOptions"
                      :key="item.bottleBarcodeTagTempId"
                      :title="item.tempName"
                      :label="item.tempCodeno"
                      :value="item.tempCodeno"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="1">
                <el-form-item><b>生成瓶贴</b></el-form-item>
                <el-form-item style="margin-top: 50px;">
                  <el-checkbox v-model="form.bottleTagPrint" @change="handleForceUpdate"/>
                </el-form-item>
              </el-col>
              <el-col :span="3">
                <el-form-item><b>序列号</b></el-form-item>
                <el-form-item style="margin-top: 50px;">
                  <el-input-number v-model="form.seqNo"
                                   style="width: 140px;"
                                   :min="1"
                                   controls-position="right"
                                   @change="handleForceUpdate"
                                   placeholder="序列号">
                  </el-input-number>
                </el-form-item>
              </el-col>
              <el-col :span="3">
                <el-form-item><b>分装量(ml)</b></el-form-item>
                <el-form-item v-for="(item4 ,index2) of form.siemensReagentFormDetailList" :key="index2">
                  <el-input-number v-model="item4.productVolume"
                                   style="width: 140px;"
                                   :min="1" :precision="1"
                                   controls-position="right"
                                   @change="handleForceUpdate"
                                   placeholder="装量">
                  </el-input-number>
                </el-form-item>
              </el-col>
              <el-col :span="3">
                <el-form-item><b>瓶孔</b></el-form-item>
                <el-form-item v-for="(item4 ,index2) of form.siemensReagentFormDetailList" :key="index2">
                  <el-select v-model="item4.bottleSize" style="width: 140px;">
                    <el-option label="w1" value="w1"></el-option>
                    <el-option label="w2" value="w2"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="3  ">
                <el-form-item><b>包装规格</b></el-form-item>
                <el-form-item style="margin-top: 50px;">
                  <el-input-number v-model="form.reagentSize"
                                   style="width: 140px;"
                                   :min="1"
                                   controls-position="right"
                                   @change="handleForceUpdate"
                                   placeholder="规格">
                  </el-input-number>
                  瓶/盒
                </el-form-item>
              </el-col>
            </el-row>
          </el-row>
          <!--表单模式 西门子 end-->
          <el-col :span="18">
            <el-form-item label="备注" prop="remark" label-width="85px">
              <el-input type="textarea" v-model="form.remark" show-word-limit maxlength="255"
                        placeholder="请输入备注">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6" v-show="addShow">
            <el-form-item label-width="85px">
              <el-button type="primary" @click="handleReagentSpecSave">添 加</el-button>
            </el-form-item>
          </el-col>
          <el-table
            v-show="addShow"
            ref="multipleTable"
            :data="tableData"
            style="width: 100%"
            height="300"
            @selection-change="handleSelectionChangeForm">
            <el-table-column
              type="selection"
              width="55">
            </el-table-column>
            <el-table-column
              label="品名"
              sortable
              :formatter="projectFormat"
              width="120">
            </el-table-column>
            <el-table-column
              label="机型"
              sortable
              :formatter="machineTypeFormat"
              width="120">
            </el-table-column>
            <el-table-column
              prop="itemNo"
              label="货号">
            </el-table-column>
            <el-table-column
              prop="formMode"
              :formatter="formModeFormat"
              label="表单模式">
            </el-table-column>
            <el-table-column
              prop="reagentProductSpec"
              show-overflow-tooltip
              label="分装量">
            </el-table-column>
            <el-table-column
              prop="reagentSpec"
              show-overflow-tooltip
              label="包装规格">
            </el-table-column>
            <el-table-column label="操作">
              <template slot-scope="scope">
                <el-button
                  size="mini"
                  type="danger"
                  @click="handleDeleteSpec(scope.$index, scope.row)">删 除
                </el-button>
              </template>
            </el-table-column>
          </el-table>
        </el-form>
      </el-row>
      <div slot="footer" class="dialog-footer">
        <el-button v-show="addShow" type="danger" @click="handleReagentSpecDel">批量删除</el-button>
        <el-button type="primary" @click="submitForm" :loading="loadingSubmit">保 存</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {addReagentFormDetail, updateReagentFormDetail,} from "@/api/product/reagentFormDetail";
import {listProject} from "@/api/product/project";
import {listBottleType} from "@/api/product/bottleType";
import {
  addReagentForm,
  delReagentForm,
  exportReagentForm,
  getByItemNo,
  getReagentForm,
  listReagentForm,
  updateReagentForm
} from "@/api/product/reagentForm";
import {listMachineBoxBarcodeTag} from "@/api/product/machineBoxBarcodeTag";
import {listMachineBottleBarcodeTag} from "@/api/product/machineBottleBarcodeTag";

export default {
  name: "ReagentFormDetail",
  data() {
    let validateItemNo = async (rule, value, callback) => {
      if (this.form.projectId && this.form.machineType && this.form.itemNo) {
        //表格中先判断是否是已经录入的货号
        let find = this.tableData.find(item => item.itemNo === this.form.itemNo);
        //数据库中查询判断是否已经录入的货号
        let res = await getByItemNo({
          itemNo: this.form.itemNo,
          machineType: this.form.machineType
        })
        if (this.form.reagentFormId && res.total > 0) {
          if (res.rows[0].reagentFormId !== this.form.reagentFormId) {
            callback(new Error('该货号已存在'));
          } else {
            callback();
          }
        } else {
          if (find || res.total > 0) {
            callback(new Error('该货号已存在'));
          } else {
            callback();
          }
        }
      } else {
        callback()
      }

    };

    return {
      defaultModeShow: true,
      secondModeShow: false,
      thirdModeShow: false,
      fourthModeShow: false,
      addShow: false,
      loadingSubmit: false,
      disabledProject: false,
      disabledMachineType: false,
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 总条数
      total: 0,
      // 试剂表单表格数据
      reagentFormList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 试剂类型字典
      reagentTypeOptions: [],
      // 机型字典
      machineTypeOptions: [],
      //规格前缀
      specPrefixOptions: [],
      //规格单位
      specUnitOptions: [],
      //规格单位
      productUnitOptions: [],
      //表单模式
      formModeOptions: [],
      //机型盒贴标签模板字典
      machineBoxBarcodeTagOptions: [],
      //机型瓶贴标签模板字典
      machineBottleBarcodeTagOptions: [],
      //测试品名
      projectOptions: [],
      //包装瓶
      bottleTypeOptions: [],
      queryBottleTypeOptions: [],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        projectId: undefined,
        machineType: undefined,
        itemNo: undefined
      },
      // 表单参数
      form: {
        reagentFormId: undefined,
        projectId: undefined,
        machineType: undefined,
        itemNo: undefined,
        boxBarcodeTagTempCodeno: undefined,
        specPrefix: undefined,
        specUnit: '1',
        productUnit: '1',
        boxTagPrint: true,
        formMode: '1',
        boxSeqNo: undefined,
        remark: undefined,
        insReagentFormDetailList: undefined,
        containCalibrator: false,
        calibratorSpec: undefined,
        //杜邦8孔
        dbReagentFormDetailList: []
      },
      // 表单校验
      rules: {
        projectId: [
          {required: true, message: "品名不能为空", trigger: "change"}
        ],
        machineType: [
          {required: true, message: "机型不能为空", trigger: "change"}
        ],
        boxSeqNo: [
          {required: true, message: "序列号不能为空", trigger: "blur"},
        ],
        itemNo: [
          {required: true, message: "货号不能为空", trigger: "change"},
          {validator: validateItemNo, trigger: 'blur'}
        ],
        boxBarcodeTagTempCodeno: [
          {required: true, message: "标签模板不能为空", trigger: "change"},
        ],
        formMode: [
          {required: true, message: "表单模式不能为空", trigger: "change"},
        ],
        specUnit: [
          {required: true, message: "规格单位不能为空", trigger: "change"},
        ],
        productUnit: [
          {required: true, message: "分装单位不能为空", trigger: "change"},
        ],
      },
      tableData: [],
      multipleSelection: [],
    };
  },
  created() {
    this.getList();
    this.getDicts("reagent_type_flag").then(response => {
      this.reagentTypeOptions = response.data;
      // this.form.insReagentFormDetailList = this.reagentTypeOptions.slice()
    });
    this.getDicts("machine_type").then(response => {
      this.machineTypeOptions = response.data;
    });
    this.getDicts("reagent_spec_prefix").then(response => {
      this.specPrefixOptions = response.data;
    });
    this.getDicts("reagent_spec_unit").then(response => {
      this.specUnitOptions = response.data;
    });
    this.getDicts("reagent_product_unit").then(response => {
      this.productUnitOptions = response.data;
    });
    this.getDicts("reagent_form_mode").then(response => {
      this.formModeOptions = response.data;
    });
    listProject(null).then(response => {
      this.projectOptions = response.rows;
    });
    this.updateBottleType()
  },
  methods: {
    //处理表单模式更改
    handleFormModeChange() {
      const formMode = this.form.formMode;
      this.defaultModeShow = false
      this.secondModeShow = false
      this.thirdModeShow = false
      this.fourthModeShow = false
      switch (formMode) {
        case "1"://默认
          this.defaultModeShow = true
          break;
        case "2"://杜邦
          this.secondModeShow = true
          break;
        case "3"://701
          this.thirdModeShow = true
          break;
        case "4"://西门子
          this.fourthModeShow = true
          break;
        default:
      }
    },
    handleForceUpdate() {
      this.$forceUpdate();
    },
    //单行试剂规格信息删除
    handleDeleteSpec(index, row) {
      this.tableData.splice(index, 1);
    },
    handleProjectChange() {
      if (this.form.itemNo !== '') {
        let find = this.projectOptions.find(one => one.projectId === this.form.projectId);
        this.form.itemNo = find ? find.itemShortName : this.form.itemNo;
      }
    },
    //处理试剂规格记录的删除
    handleReagentSpecDel() {
      if (this.multipleSelection.length === this.tableData.length) {
        this.tableData = []
      } else {
        for (let item of this.multipleSelection) {
          let findIndex = this.tableData.findIndex(row => row.itemNo === item.itemNo);
          this.tableData.splice(findIndex, 1)
        }
      }
    },
    //保存试剂规格信息
    handleReagentSpecSave() {
      let _this = this;
      this.$refs["form"].validate(async valid => {
        if (valid) {
          const form = _this.form;
          let obj = {
            projectId: form.projectId,
            machineType: form.machineType,
            itemNo: form.itemNo,
            boxBarcodeTagTempCodeno: form.boxBarcodeTagTempCodeno,
            specPrefix: form.specPrefix,
            specUnit: form.specUnit,
            productUnit: form.productUnit,
            boxTagPrint: form.boxTagPrint,
            formMode: form.formMode,
            remark: form.remark,
            reagentSpec: '',
            reagentProductSpec: '',
            insReagentFormDetailList: []
          }
          switch (form.formMode) {
            case '1'://默认
            {
              form.insReagentFormDetailList.forEach(item => {
                if (item.bottleTypeId && item.reagentVolume && item.reagentSize && item.productVolume && item.seqNo && item.testCount && item.bottleBarcodeTagTempCodeno) {
                  if (item.testCount % 10 !== 0) {
                    _this.msgError('测试数必须是10的倍数');
                    return
                  }
                  obj.reagentSpec += item.dictLabel + ':' + item.reagentVolume + 'ml' + 'x' + item.reagentSize + ' ';
                  obj.reagentProductSpec += item.dictLabel + ':' + item.productVolume + 'ml ';
                  obj.insReagentFormDetailList.push({
                    reagentType: item.reagentType,
                    bottleTypeId: item.bottleTypeId,
                    reagentVolume: item.reagentVolume,
                    reagentSize: item.reagentSize,
                    productVolume: item.productVolume,
                    seqNo: item.seqNo,
                    testCount: item.testCount,
                    bottleTagPrint: item.bottleTagPrint,
                    bottleBarcodeTagTempCodeno: item.bottleBarcodeTagTempCodeno,
                  })
                }
              })
              if (obj.reagentSpec !== '') {
                _this.tableData.push(obj);
              } else {
                _this.msgInfo('请添加规格信息')
              }
              break;
            }
            case "2"://杜邦
            {
              form.dbReagentFormDetailList.forEach(item => {
                if (form.bottleTypeId && form.reagentSize && item.productVolume && form.seqNo && form.bottleBarcodeTagTempCodeno) {
                  let reagentType = this.reagentTypeFormat2(item.reagentType);
                  obj.reagentSpec += reagentType + ':' + item.productVolume + 'ml' + 'x' + form.reagentSize + ' ';
                  obj.reagentProductSpec += item.bottleNo + '孔' + reagentType + ':' + item.productVolume + 'ml ';
                  obj.insReagentFormDetailList.push({
                    reagentType: item.reagentType,
                    bottleTypeId: form.bottleTypeId,
                    reagentSize: form.reagentSize,
                    productVolume: item.productVolume,
                    seqNo: form.seqNo,
                    bottleTagPrint: form.bottleTagPrint,
                    bottleBarcodeTagTempCodeno: form.bottleBarcodeTagTempCodeno,
                    bottleNo: item.bottleNo
                  })
                }
              })
              if (obj.reagentProductSpec !== '') {
                _this.tableData.push(obj);
              } else {
                _this.msgInfo('请添加规格信息')
              }
              break;
            }
            case "3"://701
            {
              form.cobas701ReagentFormDetailList.forEach(item => {
                if (form.bottleTypeId && form.reagentSize && item.productVolume && item.productVolumeMin && item.productVolumeMax && form.seqNo && form.bottleBarcodeTagTempCodeno && item.bottleSize) {
                  let reagentType = this.reagentTypeFormat2(item.reagentType);
                  obj.reagentSpec += reagentType + ':' + item.productVolume + 'ml' + 'x' + form.reagentSize + ' ';
                  obj.reagentProductSpec += item.bottleSize + '孔' + reagentType + ':' + item.productVolume + 'ml [' + item.productVolumeMin + '-' + item.productVolumeMax + 'g] ';
                  obj.insReagentFormDetailList.push({
                    reagentType: item.reagentType.dictValue,
                    bottleTypeId: form.bottleTypeId,
                    reagentSize: form.reagentSize,
                    productVolume: item.productVolume,
                    seqNo: form.seqNo,
                    bottleTagPrint: form.bottleTagPrint,
                    bottleBarcodeTagTempCodeno: form.bottleBarcodeTagTempCodeno,
                    bottleSize: item.bottleSize
                  })
                }
              })
              if (obj.reagentProductSpec !== '') {
                _this.tableData.push(obj);
              } else {
                _this.msgInfo('请添加规格信息')
              }
              break;
            }
            case "4"://西门子
            {
              form.siemensReagentFormDetailList.forEach(item => {
                if (form.bottleTypeId && form.reagentSize && item.productVolume && form.seqNo && form.bottleBarcodeTagTempCodeno && item.bottleSize) {
                  let reagentType = this.reagentTypeFormat2(item.reagentType);
                  obj.reagentSpec += reagentType + ':' + item.productVolume + 'ml' + 'x' + form.reagentSize + ' ';
                  obj.reagentProductSpec += item.bottleSize + '孔' + reagentType + ':' + item.productVolume + 'ml ';
                  obj.insReagentFormDetailList.push({
                    reagentType: item.reagentType,
                    bottleTypeId: form.bottleTypeId,
                    reagentSize: form.reagentSize,
                    productVolume: item.productVolume,
                    seqNo: form.seqNo,
                    bottleTagPrint: form.bottleTagPrint,
                    bottleBarcodeTagTempCodeno: form.bottleBarcodeTagTempCodeno,
                    bottleSize: item.bottleSize
                  })
                }
              })
              if (obj.reagentProductSpec !== '') {
                _this.tableData.push(obj);
              } else {
                _this.msgInfo('请添加规格信息')
              }
              break;
            }
            default:
          }
        }
      })
    },
    /** 查询试剂表单列表 */
    getList() {
      this.loading = true;
      listReagentForm(this.queryParams).then(response => {
        this.reagentFormList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    //机型改变时重新查询包装瓶
    handleMachineChange() {
      this.updateBottleType()
      this.updateBarcodeTagTempOptions()
    },
    //更新机型标签模板
    async updateBarcodeTagTempOptions() {
      if (this.form.machineType) {
        await listMachineBoxBarcodeTag({machineType: this.form.machineType}).then(response => {
          this.machineBoxBarcodeTagOptions = response.rows;
          if (this.machineBoxBarcodeTagOptions.length > 0) {
            this.form.boxBarcodeTagTempCodeno = 1
          } else {
            this.form.boxBarcodeTagTempCodeno = undefined
          }
        });
        await listMachineBottleBarcodeTag({machineType: this.form.machineType}).then(response => {
          this.machineBottleBarcodeTagOptions = response.rows;
          if (this.machineBottleBarcodeTagOptions.length > 0) {
            this.form.insReagentFormDetailList.forEach(item => {
              // item.bottleBarcodeTagTempCodeno = '1'
              // item.bottleTagPrint = true
              // item.reagentSize = 2
              // item.testCount = 100
            })
          } else {
            this.form.insReagentFormDetailList.forEach(item => {
              item.bottleBarcodeTagTempCodeno = undefined
              item.reagentSize = 2
              item.testCount = 100
            })
          }
        });

      }
    },
    //更新包装瓶类型
    async updateBottleType() {
      if (this.form.machineType) {
        await listBottleType({machineType: this.form.machineType}).then(response => {
          this.bottleTypeOptions = response.rows;
        });
      }
    },
    //更新表单中得规格信息表格
    updateTableData() {
      let obj = {
        projectId: this.form.projectId,
        machineType: this.form.machineType,
        itemNo: this.form.itemNo,
        boxBarcodeTagTempCodeno: this.form.boxBarcodeTagTempCodeno,
        specPrefix: this.form.specPrefix,
        specUnit: this.form.specUnit,
        productUnit: this.form.productUnit,
        boxTagPrint: this.form.boxTagPrint,
        formMode: this.form.formMode,
        remark: this.form.remark,
        reagentSpec: '',
        insReagentFormDetailList: []
      }
      this.form.insReagentFormDetailList.forEach(item => {
        if (item.bottleTypeId && item.reagentVolume && item.reagentSize) {
          let str = item.dictLabel + ':' + item.reagentVolume + 'ml' + 'x' + item.reagentSize + ' '
          item.reagentSpec += str
        }
      })
      if (obj.reagentSpec !== '') {
        this.tableData.push(obj);
      } else {
        this.msgInfo('请添加规格信息')
      }
    },
    //查询产品品名
    projectFormat(row, column) {
      let find = this.projectOptions.find(one => one.projectId === row.projectId);
      return find ? find.name : ''
    },
    // 机型字典翻译
    machineTypeFormat(row, column) {
      return this.selectDictLabel(this.machineTypeOptions, row.machineType);
    },
    // 试剂类型字典翻译
    reagentTypeFormat(row, column) {
      return this.selectDictLabel(this.reagentTypeOptions, row.reagentType);
    },
    // 试剂类型字典翻译2
    reagentTypeFormat2(reagentType) {
      return this.selectDictLabel(this.reagentTypeOptions, reagentType);
    },
    // 表单模式翻译
    formModeFormat(row) {
      return this.selectDictLabel(this.formModeOptions, row.formMode);
    },
    //规格信息翻译
    specFormat(row, column) {
      let reagentSpec = '';
      for (let item of row.insReagentFormDetailList) {
        let str = this.selectDictLabel(this.reagentTypeOptions, item.reagentType)
          + ':' + item.reagentVolume + 'ml' + 'x'
          + item.reagentSize + ' '
        reagentSpec += str
      }
      return reagentSpec;
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      let arr = this.reagentTypeOptions.slice();
      arr.forEach(item => {
        item.reagentType = item.dictValue;
        item.bottleDetailId = undefined
        item.bottleTagPrint = true
        item.bottleTypeId = undefined
        item.productVolume = undefined
        item.reagentFormId = undefined
        item.reagentSize = 2
        item.reagentVolume = undefined
        item.seqNo = 1
        item.testCount = 100
        item.bottleBarcodeTagTempCodeno = undefined
      });
      this.form = {
        reagentFormId: undefined,
        projectId: undefined,
        machineType: undefined,
        itemNo: undefined,
        boxBarcodeTagTempCodeno: undefined,
        specPrefix: undefined,
        specUnit: '1',
        productUnit: '1',
        boxTagPrint: true,
        bottleTagPrint: true,
        formMode: '1',
        boxSeqNo: 1,
        seqNo: 1,
        remark: undefined,
        insReagentFormDetailList: arr,
        dbReagentFormDetailList: [
          {
            bottleNo: 1,
            reagentType: '1'
          }, {
            bottleNo: 2,
            reagentType: '1'
          }, {
            bottleNo: 3,
            reagentType: '1'
          }, {
            bottleNo: 4,
            reagentType: '1'
          }, {
            bottleNo: 5,
            reagentType: '2'
          }, {
            bottleNo: 6,
            reagentType: '2'
          }, {
            bottleNo: 7,
            reagentType: '2'
          }, {
            bottleNo: 8,
            reagentType: '2'
          }
        ],
        cobas701ReagentFormDetailList: [
          {
            bottleNo: 1,
            reagentType: '1',
            bottleSize: '大'
          }, {
            bottleNo: 2,
            reagentType: '2',
            bottleSize: '小'
          }
        ],
        siemensReagentFormDetailList: [
          {
            bottleNo: 1,
            reagentType: '1',
            bottleSize: 'w1'
          }, {
            bottleNo: 2,
            reagentType: '1',
            bottleSize: 'w2'
          }, {
            bottleNo: 3,
            reagentType: '2',
            bottleSize: 'w1'
          }, {
            bottleNo: 4,
            reagentType: '2',
            bottleSize: 'w2'
          }
        ]
      };
      this.bottleTypeOptions = []
      this.machineBoxBarcodeTagOptions = []
      this.machineBottleBarcodeTagOptions = []
      this.queryBottleTypeOptions = []
      this.tableData = []
      this.disabledProject = false
      this.disabledMachineType = false
      this.defaultModeShow = true
      this.secondModeShow = false
      this.thirdModeShow = false
      this.fourthModeShow = false
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.reagentFormId)
      this.single = selection.length !== 1
      this.multiple = !selection.length
    },
    handleSelectionChangeForm(val) {
      this.multipleSelection = val;
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.addShow = true;
      this.open = true;
      this.title = "添加试剂表单";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const reagentFormId = row.reagentFormId || this.ids
      getReagentForm(reagentFormId).then(async response => {
        this.form = response.data;
        await this.updateBottleType()
        await this.updateBarcodeTagTempOptions()
        this.addShow = false;
        this.disabledProject = true
        this.disabledMachineType = true
        this.open = true;
        this.title = "修改试剂表单";
        this.handleForceUpdate()
      });
    },
    /** 提交按钮 */
    submitForm: function () {
      if (this.tableData.length <= 0 && this.addShow) {
        this.msgInfo('请录入表单并添加规格信息')
      } else {
        if (this.form.reagentFormId !== undefined) {
          this.$refs["form"].validate(async valid => {
            if (valid) {
              let flag = true;
              let flagTestCount = true;
              for (let item of this.form.insReagentFormDetailList) {
                if (item.testCount && item.testCount % 10 !== 0 && flagTestCount) {
                  flagTestCount = false
                }
                if (flag && !item.bottleTypeId || !item.reagentVolume || !item.reagentSize || !item.productVolume || !item.seqNo || !item.testCount) {
                  flag = false
                }
              }
              if (!flagTestCount) {
                this.msgError('测试数必须是10的倍数');
                return
              }
              if (flag) {
                this.loadingSubmit = true;
                new Promise(function (resolve) {
                  resolve();
                })
                  .then(async () => {
                    await updateReagentForm(this.form).then(async response => {
                      if (response.code === 200) {
                        for (let reagentFormDetail of this.form.insReagentFormDetailList) {
                          await updateReagentFormDetail(reagentFormDetail)
                        }
                      }
                    });
                  })
                  .then(_ => {
                    this.msgSuccess("修改成功");
                    this.open = false;
                    this.getList();
                    this.loadingSubmit = false
                  });

              } else {
                this.msgInfo('请将规格信息填写完整');
              }
            }
          })
        } else {
          new Promise(function (resolve) {
            resolve();
          }).then(() => {
            this.loadingSubmit = true
            this.tableData.forEach(async item => {
              await addReagentForm(item).then(async response => {
                if (response.code === 200) {
                  for (const one of item.insReagentFormDetailList) {
                    one.reagentFormId = response.data.reagentFormId
                    await addReagentFormDetail(one)
                  }
                }
              });
            })
          }).then(() => {
            let _this = this
            setTimeout(function () {
              _this.msgSuccess("新增成功");
              _this.open = false;
              _this.getList();
              _this.loadingSubmit = false
            }, 800);
          });
        }
      }
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const reagentFormIds = row.reagentFormId || this.ids;
      this.$confirm('是否确认删除选择的数据项?', "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(function () {
        return delReagentForm(reagentFormIds);
      }).then(() => {
        this.getList();
        this.msgSuccess("删除成功");
      }).catch(function () {
      });
    },
    /** 导出按钮操作 */
    handleExport() {
      const queryParams = this.queryParams;
      this.$confirm('是否确认导出所有试剂表单数据项?', "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(function () {
        return exportReagentForm(queryParams);
      }).then(response => {
        this.download(response.msg);
      }).catch(function () {
      });
    }
  }
}
;
</script>
